//
// Created by Semir on 2020/4/26.
//

#include <iostream>

using namespace std;

const int MAX_N = 105;
int n;
int arr[MAX_N];

int main() {
    int sum = 0;
    int count = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        sum += arr[i];
    }
    sum /= n;
    for (int i = 0; i < n - 1; i++) {
        if (arr[i] != sum) {
            arr[i + 1] -= sum - arr[i];
            count++;
        }
    }
    cout << count << endl;
    return 0;
}